home *** CD-ROM | disk | FTP | other *** search
- /* ProgramWindow.c */ /* C14 Calculator */
- /* Created 940113 1:07 by AppMaker */
-
- #ifndef __C14__
- #include "PredatorPrey.h"
- #endif
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <Resources.h>
- #include <TextEdit.h>
- #include <ToolUtils.h>
- #include "ResourceDefs.h"
- #include "Globals.h"
- #include "Miscellany.h"
- #include "Scrolling.h"
- #include "WindowAids.h"
- #include "ProgWindowRsrcData.h"
- #include "ProgramWindow.h"
- #include "myLClikLoop.h"
-
-
- #define List1 1
- #define List2 2
- #define List3 3
-
- static void BuildList1 (void);
- static void BuildList2 (void);
- static void BuildList3 (void);
-
- /*----------*/
- static void BuildList1 ()
- {
- Rect bounds;
- short i,rowInt;
-
- SetWFont (List1);
- GetWRect (List1, &bounds);
- cur->List1HandleProgramWindow = NewV1SList (bounds, qd.thePort);
- rowInt = frog.END - 1;
- if(rowInt >= 1)
- {
- for(i = 0;i <= rowInt;i++)
- {
- AddToList ("\po", cur->List1HandleProgramWindow);
- }
- }
- /* AddToList ("\pOne", cur->List1HandleProgramWindow);*/
- /* AddToList ("\pTwo", cur->List1HandleProgramWindow);*/
- /* AddToList ("\pThree", cur->List1HandleProgramWindow);*/
- /* AddToList ("\pInfinity", cur->List1HandleProgramWindow);*/
- LDoDraw (true, cur->List1HandleProgramWindow);
-
- } /*BuildList1*/
-
- /*----------*/
- static void BuildList2 ()
- {
- Rect bounds;
- short i,rowInt;
- short dataLen;
- Cell theCell;
- short newRow;
-
- #define maxint 32767
-
- SetWFont (List2);
- GetWRect (List2, &bounds);
- cur->List2HandleProgramWindow = NewV1SList (bounds, qd.thePort);
- rowInt = frog.END - 1;
- if(rowInt >= 1)
- {
- dataLen = 12;
- for(i = 0;i <= rowInt;i++)
- {
- newRow = LAddRow (1, maxint, cur->List2HandleProgramWindow);
- theCell.v = i;
- theCell.h = 0;
- LSetCell(&frog.run[i].pStr[1],dataLen,theCell,cur->List2HandleProgramWindow);
- }
- }
-
- /* AddToList ("\pTwo", cur->List2HandleProgramWindow);*/
- /* AddToList ("\pThree", cur->List2HandleProgramWindow);*/
- /* AddToList ("\pInfinity", cur->List2HandleProgramWindow);*/
- LDoDraw (true, cur->List2HandleProgramWindow);
-
- } /*BuildList2*/
-
- /*----------*/
- static void BuildList3 ()
- {
- Rect bounds;
- short i,rowInt;
- short dataLen;
- Cell theCell;
- short newRow;
-
- #define maxint 32767
-
- SetWFont (List3); /* in WindowAids.c */
- GetWRect (List3, &bounds); /* in WindowAids.c */
- cur->List3HandleProgramWindow = NewV1SList (bounds, qd.thePort);
- //SetClikLoop((UniversalProcPtr) myLClikLoop,cur->List3HandleProgramWindow);
- rowInt = frog.END - 1;
- if(rowInt >= 1)
- {
- dataLen = 12;
- for(i = 0;i <= rowInt;i++)
- {
- newRow = LAddRow (1, maxint, cur->List3HandleProgramWindow);
- theCell.v = i;
- theCell.h = 0;
- LSetCell(&frog.run[i].pStr[1],dataLen,theCell,cur->List3HandleProgramWindow);
- }
- }
- /* AddToList ("\pOne", cur->List3HandleProgramWindow);*/
- /* AddToList ("\pTwo", cur->List3HandleProgramWindow);*/
- /* AddToList ("\pThree", cur->List3HandleProgramWindow);*/
- /* AddToList ("\pInfinity", cur->List3HandleProgramWindow);*/
- LDoDraw (true, cur->List3HandleProgramWindow);
-
- } /*BuildList3*/
-
- /*----------*/
- WindowPtr OpenProgramWindow (Str255 fName,
- short vRefNum,
- short fRefNum)
- {
- WindowPtr newWindow;
- WindowPtr saveWindow;
-
- Rect bounds;
-
- newWindow = GetWindow (ProgramWindowID);
- if (fName [0] != 0) {
- SetWTitle (newWindow, fName);
- }
- /* altCurWindow = curWindow;*/
- /* SetAltInfo(altCurWindow);*/
- SetPort (newWindow);
- SetNewInfo (newWindow);
- /*cur->map = altCur->map;*/
- cur->vScroll = nil;
- cur->hScroll = nil;
- cur->fileNum = fRefNum;
- cur->volNum = vRefNum;
- cur->dirty = false;
- cur->filename = NewString (fName);
- cur->windowKind = WProgramWindow;
- ((WindowPeek) curWindow)->windowKind = userKind + WProgramWindow;
- cur->witlHandle = GetResource ('Witl', ProgramWindowID);
- cur->wictHandle = GetResource ('Wict', ProgramWindowID);
-
- BuildList1 (); /* this */
- BuildList2 ();
- BuildList3 ();
-
- cur->text = nil;
- return(newWindow);
-
- } /*OpenProgramWindow*/
-
- /*----------*/
- void CloseProgramWindow (void)
- {
- WindowPtr whichWindow;
-
- if ( ( whichWindow = FrontWindow() ) != gProgWindow)
-
- {
- SelectWindow(gProgWindow);
- SetInfo(gProgWindow);
- }
- LDispose (cur->List1HandleProgramWindow);
- LDispose (cur->List2HandleProgramWindow);
- LDispose (cur->List3HandleProgramWindow);
-
- DisposHandle ((Handle) cur->filename);
- DiscardInfo (curWindow);
- } /*CloseProgramWindow*/
-
- /*----------*/
- void ControlProgramWindow (ControlHandle whichControl,
- short whichPart,
- Point where)
- {
- Rect bounds;
- short deltaRows,deltaClms;
-
- if ((whichControl == (**(cur->List1HandleProgramWindow)).vScroll)
- || (whichControl == (**(cur->List1HandleProgramWindow)).hScroll)) {
- if (LClick (where, 0, cur->List1HandleProgramWindow)) {
- /*double click in scroll bar*/
- }
- }
- if ((whichControl == (**(cur->List2HandleProgramWindow)).vScroll)
- || (whichControl == (**(cur->List2HandleProgramWindow)).hScroll)) {
- if (LClick (where, 0, cur->List2HandleProgramWindow)) {
- /*double click in scroll bar*/
- }
- }
- if ((whichControl == (**(cur->List3HandleProgramWindow)).vScroll)
- || (whichControl == (**(cur->List3HandleProgramWindow)).hScroll)) {
- /*switch(whichPart)*/
- /* {*/
- /* case inUpButton:*/
- /* deltaRows = 1;*/
- /* break;*/
- /* case inDownButton:*/
- /* deltaRows = -1;*/
- /* break;*/
- /* case inPageUp:*/
- /* deltaRows = 20;*/
- /* break;*/
- /* case inPageDown:*/
- /* deltaRows = -20;*/
- /* break;*/
- /* }*/
- /* while(gTheEvent.message != mouseUp)*/
- /* {*/
- /* LScroll( deltaClms, deltaRows, cur->List1HandleProgramWindow );*/
- /* LScroll( deltaClms, deltaRows, cur->List2HandleProgramWindow );*/
- /* LScroll( deltaClms, deltaRows, cur->List3HandleProgramWindow );*/
- /* }*/
- if (LClick (where, 0, cur->List3HandleProgramWindow)) {
- /*double click in scroll bar*/
- }
- }
-
- } /*ControlProgramWindow*/
-
- /*----------*/
- void MouseInProgramWindow (Point where,
- short modifiers)
- {
- Rect bounds;
-
- if (PtInRect (where, &(**(cur->List1HandleProgramWindow)).rView)) {
- if (LClick (where, modifiers, cur->List1HandleProgramWindow)) {
- /*double click*/
- }
- if (GetListChoice (&cur->List1ChoiceProgramWindow, cur->List1HandleProgramWindow)) {
- /* something is selected */
- }
- }
- if (PtInRect (where, &(**(cur->List2HandleProgramWindow)).rView)) {
- if (LClick (where, modifiers, cur->List2HandleProgramWindow)) {
- /*double click*/
- }
- if (GetListChoice (&cur->List2ChoiceProgramWindow, cur->List2HandleProgramWindow)) {
- /* something is selected */
- }
- }
- if (PtInRect (where, &(**(cur->List3HandleProgramWindow)).rView)) {
- if (LClick (where, modifiers, cur->List3HandleProgramWindow)) {
- /*double click*/
- }
- if (GetListChoice (&cur->List3ChoiceProgramWindow, cur->List3HandleProgramWindow)) {
- /* something is selected */
- }
- }
-
- } /*MouseInProgramWindow*/
-
- /*----------*/
- void TypeInProgramWindow (char ch)
- {
- if (cur->text == nil) {
- SysBeep (1);
- } else {
- TEKey (ch, cur->text);
- cur->dirty = true;
- }
- } /*TypeInProgramWindow*/
-
- /*----------*/
- void UpdateProgramWindow (void)
- {
- Rect bounds;
-
- SetWFont (List1);
- LUpdate (qd.thePort->visRgn, cur->List1HandleProgramWindow);
- bounds = (**(cur->List1HandleProgramWindow)).rView;
- InsetRect (&bounds, -1, -1);
- FrameRect (&bounds);
- SetWFont (List2);
- LUpdate (qd.thePort->visRgn, cur->List2HandleProgramWindow);
- bounds = (**(cur->List2HandleProgramWindow)).rView;
- InsetRect (&bounds, -1, -1);
- FrameRect (&bounds);
- SetWFont (List3);
- LUpdate (qd.thePort->visRgn, cur->List3HandleProgramWindow);
- bounds = (**(cur->List3HandleProgramWindow)).rView;
- InsetRect (&bounds, -1, -1);
- FrameRect (&bounds);
-
- } /*UpdateProgramWindow*/
-
- /*----------*/
- void ActivateProgramWindow (Boolean activate)
- {
- LActivate (activate, cur->List1HandleProgramWindow);
- LActivate (activate, cur->List2HandleProgramWindow);
- LActivate (activate, cur->List3HandleProgramWindow);
-
- } /*ActivateProgramWindow*/
-
- /*----------*/
- void ResizeProgramWindow (void)
- {
- /* application-specific code to resize items in window */
- } /*ResizeProgramWindow*/
-
- /*----------*/
- pascal void ScrollProgramWindow (short newValue,
- short oldValue)
- {
- /* application-specific code to scroll window */
- } /*ScrollProgramWindow*/
-
- /* ProgramWindow */
-